/*
 * @Date: 2024-04-02 16:05:22
 * @LastEditors: bingkui.wu
 * @LastEditTime: 2024-04-02 16:06:16
 * @Description: 通过wordId集合获取word对象
 */
import { REQUEST } from "#type/request";
import Response from "@common/Response";
import { BookWord } from "@models/BookWord";

const root: REQUEST.BASIC = {
  auth: false,
  method: "post",
  request: async (ctx: any) => {
    const { wordIds } = ctx.request.body;

    const words = await BookWord.find({
      wordId: { $in: wordIds },
    })
      .lean()
      .select("-_id -__v")
      .exec();

    return Response.Success(words);
  },
};

export default root;
